﻿using System.Collections.Generic;
using Inovout.Land.Domain;
using System.Diagnostics;
using System.Linq;

namespace Inovout.Gis.Land.GuiHua
{
    /// <summary>
    /// 基期年地类
    /// </summary>
    public class JQNTuBanLayer : TuBanGroupLayer
    {

        public static readonly JQNTuBanLayer Instance = new JQNTuBanLayer(GetTuBanGroupLayer());

        private static TuBanGroupLayer GetTuBanGroupLayer()
        {
             return MapObject.Current.Layers.Single(layer => layer is TuBanGroupLayer && layer.Name.Equals("基期现状")) as TuBanGroupLayer;
       }
        private JQNTuBanLayer(TuBanGroupLayer tuBanGroupLayer)
            : base(tuBanGroupLayer)
        {
        }
        public JQNTuBanLayer(IGroupLayerObject groupLayer) :
            base(groupLayer as IGroupLayerInfo)
        {
        }

        //private void BuildTuBanLayer(IGroupLayerInfo groupLayer)
        //{
        //    if (this.Layers == null || this.Layers.Count==0)
        //    {
        //        foreach (var layer in groupLayer.Layers)
        //        {
        //            if (layer is IGroupLayerInfo)
        //            {
        //                BuildTuBanLayer(layer as IGroupLayerInfo);
        //            }
        //            else if (layer is IGeometryLayerInfo)
        //            {
        //                if (layer.Name.Equals("G31_H_PY") || layer.Name.Equals("G32_H_PL") || layer.Name.Equals("G33_H_PT"))
        //                {
        //                    this.Layers.Add(layer);
        //                }
        //            }
        //        }
        //    }
        //}
  

        public List<TuBan> GetTuBans()
        {
            //foreach (var groupLayer in MapElement.Current.Layers)
            //{
            //    if (groupLayer is IGroupLayerInfo)
            //    {
            //        BuildTuBanLayer(groupLayer as IGroupLayerInfo);
            //    }
            //}
            Stopwatch stopwatch = Stopwatch.StartNew();
            List<TuBan> tuBans = base.LineLayer.TuBans;
            stopwatch.Stop();
            return null;
        }
         //    public List<FLMJX> GetDLMJXs()
        //    {
        //        pointLayer.GetDLMJXs();
        //        lineLayer.GetDLMJXs();
        //        polygonLayer.GetDLMJXs();

        //        double pointIntersectLineArea = 0;
        //        double mj;
        //        List<DiLeiPoint> points = new List<DiLeiPoint>(pointLayer.Points);
        //        foreach (var point in points)
        //        {
        //            lineLayer.Intersect(point, out mj);
        //            pointIntersectLineArea += mj;
        //            if (mj > 0)
        //            {
        //                points.Remove(point);
        //            }
        //        }
        //        double pointIntersectPolygonArea = 0;
        //        foreach (var point in points)
        //        {
        //            polygonLayer.Intersect(point, out mj);
        //            pointIntersectPolygonArea += mj;
        //            if (mj > 0)
        //            {
        //                points.Remove(point);
        //            }
        //        }

        //        return null;
        //    }
    }
}
